package com.tgram.android_mapapi.Util;

import java.io.File;

import android.content.Context;
import android.os.Environment;

//文件目录管理类
public class DirManager {
	//public static final String DIR_SD_ROOT = Environment.getExternalStorageDirectory().getAbsolutePath();
	public static final String DIR_SD_ROOT = Environment.getExternalStorageDirectory().getPath();
	//public static final String DIR_SD_ROOT = Environment.getDataDirectory().getPath();
	//public static final String DIR_SD_ROOT = Environment.getDownloadCacheDirectory().getPath() ;
	//public static final String DIR_SD_ROOT = Environment.getRootDirectory().getPath();
	public static final String DIR_APP_ROOT = DIR_SD_ROOT + File.separator
			+ "tgram" + File.separator + "threereality";
	// 地图本地缓存地址
	public static final String DIR_MAP_CACHE = DIR_APP_ROOT + File.separator
			+ "map" + File.separator + "drmap/";
	public static final String DIR_DOWNLOAD = DIR_APP_ROOT + File.separator
			+ "download";
	private static DirManager dirmanager;

	public static DirManager getDirManager() {
		if (dirmanager == null) {
			dirmanager = new DirManager();

		}
		return dirmanager;
	}

	// 初始化文件目录
	public void initAppDir() {
		File filedir = new File(DIR_APP_ROOT);
		if (!filedir.exists()) {
			filedir.mkdirs();
		}
		File filedir1 = new File(DIR_MAP_CACHE);
		if (!filedir1.exists()) {
			filedir1.mkdirs();
		}
		File filedir2 = new File(DIR_DOWNLOAD);
		if (!filedir2.exists()) {
			filedir2.mkdirs();
		}
	}

}
